var api = require('../../utils/api.js');
var app = getApp();


Page({

  /**
   * 页面的初始数据
   */
  data: {
    page:1,
    lists:[]
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    this.getlist();
  },


  getlist(params) {
    var page=this.data.page;
    var lists=this.data.lists;
    var that=this;

    api.get({
      url: 'wxapp/user/indexlistbypage',
      data: {page:page},
      success: data => {
        console.log(data);
        var list=data.data;
        
        if(list.length>0){

          list.forEach(function (index) {
            
            lists.push(index);

          })

          that.setData({
            lists:lists,
            page:page+1
          })

        }


      }
    });

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getlist();
  },

  nexturl(ret){
    console.log(ret);
    var url=ret.currentTarget.dataset.url;

    wx.navigateTo({
      url: url
    })

  }

})